package com.xiaocg.visitor;

import java.util.ArrayList;
import java.util.List;

public class Home {
    private List<Animal> animals = new ArrayList<>();

    public void add(Animal a){
        animals.add(a);
    }

    public void action(Person p){
        animals.forEach(animal -> {
            animal.accept(p);
        });
    }
}
